home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / RIncludes / Quickdraw.r < prev    next >
Encoding:
Text File  |  1997-08-12  |  13.1 KB  |  397 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Quickdraw.r
  3.  
  4.      Contains:    Quickdraw Graphics Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18.  
  19. #ifndef __QUICKDRAW_R__
  20. #define __QUICKDRAW_R__
  21.  
  22. #ifndef __CONDITIONALMACROS_R__
  23. #include "ConditionalMacros.r"
  24. #endif
  25.  
  26.  
  27. /*----------------------------acur • Cursor Pointers -----------------------------------*/
  28. type 'acur' {
  29.        integer = $$CountOf(CursIdArray); /* Nbr of cursors                 */
  30.        fill word;                        /* Next frame to show             */
  31.        array CursIdArray {
  32.            integer;                      /* 'CURS' resource id for a frame */
  33.            fill word;                    /* Pad word to make longint       */
  34.        };
  35. };
  36.  
  37.  
  38. /*---------------------------clut • Generic Color Lookup Table---------------------------*/
  39. /*
  40.     clut_RezTemplateVersion:
  41.         0 - original 
  42.         1 - implicit header, auto index value                 <-- default
  43. */
  44. #ifndef clut_RezTemplateVersion
  45.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  46.         #define clut_RezTemplateVersion 0
  47.     #else
  48.         #define clut_RezTemplateVersion 1
  49.     #endif
  50. #endif
  51.  
  52. type 'clut' {
  53.     #if clut_RezTemplateVersion == 0
  54.         unsigned hex longint;                                    /* ctSeed                */
  55.         integer;                                                /* ctFlags                */
  56.     #else
  57.         unsigned hex longint = 0;                                /* ctSeed                */
  58.         integer = 0;                                            /* ctFlags                */
  59.     #endif
  60.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  61.         wide array ColorSpec {
  62.     #if clut_RezTemplateVersion == 0
  63.                 integer;                                        /* value                */
  64.     #else
  65.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  66.     #endif
  67.                 unsigned integer;                                /* RGB:    red                */
  68.                 unsigned integer;                                /*        green            */
  69.                 unsigned integer;                                /*        blue            */
  70.         };
  71. };
  72.  
  73.  
  74. /*----------------------------------- common macros ---------------------------------------*/
  75.  
  76. #define    PixMapHeight    ( $$BitField(Bounds, 32, 16) /* bottom */            \
  77.                         - $$BitField(Bounds, 0, 16) /* top */ )
  78. #define    PixMapWidth        ( $$BitField(Bounds, 48, 16) /* right */            \
  79.                         - $$BitField(Bounds, 16, 16) /* left */ )
  80. #define    PixMapBounds    integer = $$BitField(Bounds, 0, 16) /* top */;        \
  81.                         integer = $$BitField(Bounds, 16, 16) /* left */;    \
  82.                         integer = $$BitField(Bounds, 32, 16) /* bottom */;    \
  83.                         integer = $$BitField(Bounds, 48, 16) /* right */
  84. #define    PixMapRowBytes    (((PixMapWidth * $$Word(PixelSize) + 15) / 16) * 2)
  85. #define    BitMapRowBytes    (((PixMapWidth + 15) / 16) * 2)
  86.  
  87. #define    PixMapHeightIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 32, 16) /* bottom */            \
  88.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 0, 16) /* top */ )
  89. #define    PixMapWidthIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 48, 16) /* right */            \
  90.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 16, 16) /* left */ )
  91. #define    PixMapRowBytesIndexed    (((PixMapWidthIndexed * $$Word(PixelSize[$$ArrayIndex(PixPatArray)]) + 15) / 16) * 2)
  92.  
  93.  
  94. /* RGB colors */
  95. #define whiteRGB $FFFF, $FFFF, $FFFF
  96. #define blackRGB 0, 0, 0
  97.  
  98. /* colors for 'crsr' resources */
  99. #define transparentRGB $FFFF, $FFFF, $FFFF
  100. #define invertRGB 0, 0, 0
  101.  
  102.  
  103. /*------------------------crsr • old Color Cursor template----------------------------------*/
  104. /*
  105.     crsr_RezTemplateVersion:
  106.         0 - original 
  107.         1 - color plus simplified source format             <-- default
  108. */
  109. #ifndef crsr_RezTemplateVersion
  110.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  111.         #define crsr_RezTemplateVersion 0
  112.     #else
  113.         #define crsr_RezTemplateVersion 1
  114.     #endif
  115. #endif
  116.  
  117.  
  118. type 'crsr' {
  119.     #if crsr_RezTemplateVersion == 0
  120.         hex unsigned integer    oldCursor   = $8000,            /* Type of cursor        */
  121.                                 colorCursor = $8001;
  122.     #else
  123.         unsigned hex integer = $8001;                            /* Type of cursor        */
  124.     #endif        
  125.         unsigned longint = pixMap / 8;                            /* Offset to pixMap        */
  126.         unsigned longint = pixelData / 8;                        /* Offset to pixel data    */
  127.         fill long;                                                /* Expanded cursor data    */
  128.         fill word;                                                /* Expanded data depth    */
  129.         fill long;                                                /* Reserved                */
  130.         hex string [32];                                        /* One bit cursor data    */
  131.         hex string [32];                                        /* One bit cursor mask    */
  132.         point;                                                    /* Hot spot             */
  133.         fill long;                                                /* Table id                */
  134.         fill long;                                                /* id for cursor        */
  135.  
  136.         /* IconPMap (pixMap) record */
  137.     pixMap:
  138.         fill long;                                                /* Base address            */
  139.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  140.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  141.     #if    crsr_RezTemplateVersion == 0    
  142.         unsigned bitstring[13];                                    /* Offset to next row    */
  143.         rect;                                                    /* Bitmap bounds        */
  144.         integer;                                                /* pixMap version number*/
  145.         integer    unpacked;                                        /* Packing format        */
  146.         unsigned longint;                                        /* Size of pixel data    */
  147.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  148.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  149.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  150.         integer;                                                /* # bits in pixel        */
  151.         integer;                                                /* # components in pixel*/
  152.         integer;                                                /* # bits per field        */
  153.         unsigned longint;                                        /* Offset to next plane    */
  154.         unsigned longint = colorTable / 8;                        /* Offset to color table*/
  155.         fill long;                                                /* Reserved                */
  156.  
  157.     pixelData:
  158.         hex string [(colorTable - pixelData) / 8];                /* Pixel data            */
  159.     #else
  160.  
  161.  
  162.     pMapRowBytes:
  163.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  164.  
  165.     Bounds:    
  166.         rect = { 0, 0, 16, 16 };                                /* Bitmap bounds        */
  167.         integer = 0;                                            /* pixMap vers number    */
  168.         integer = 0;                                            /* Packing format        */
  169.         fill long;                                                /* Size of pixel data    */
  170.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  171.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  172.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  173.     PixelSize:
  174.         integer;                                                /* # bits in pixel        */
  175.         integer = 1;                                            /* # components in pixel*/
  176.         integer = $$Word(PixelSize);                            /* # bits per field        */
  177.         fill long;
  178.         unsigned longint = ColorTable / 8;
  179.         fill long;
  180.  
  181.     PixelData:
  182.         hex string [PixMapRowBytes * PixMapHeight];
  183.     #endif
  184.  
  185.         /* Color Table */
  186.     colorTable:
  187.         unsigned hex longint;                                    /* ctSeed                */
  188.         integer;                                                /* ctFlags                */
  189.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  190.         wide array ColorSpec {
  191.                 integer;                                        /* value                */
  192.                 unsigned integer;                                /* RGB:    red                */
  193.                 unsigned integer;                                /*        green            */
  194.                 unsigned integer;                                /*        blue            */
  195.         };
  196. };
  197.  
  198.  
  199. /*----------------------------CURS • Cursor---------------------------------------------*/
  200. type 'CURS' {
  201.         hex string [32];                                        /* Data                 */
  202.         hex string [32];                                        /* Mask                 */
  203.         point;                                                    /* Hot spot             */
  204. };
  205.  
  206.  
  207. /*----------------------------PAT  • Quickdraw Pattern----------------------------------*/
  208. type 'PAT ' {
  209.         hex string[8];                                            /* Pattern                */
  210. };
  211.  
  212.  
  213. /*----------------------------PAT# • Quickdraw Pattern List-----------------------------*/
  214. type 'PAT#' {
  215.         integer = $$Countof(PatArray);
  216.         array PatArray {
  217.                 hex string[8];                                    /* Pattern                */
  218.         };
  219. };
  220.  
  221.  
  222. #ifndef __PICT_R__
  223.     #ifndef PICT_RezTemplateVersion
  224.         #define PICT_RezTemplateVersion 0
  225.     #endif
  226.     #ifndef __PICTUTILS_R__
  227.         #include "PictUtils.r"
  228.     #endif
  229. #endif __PICT_R__
  230.  
  231.  
  232. /*------------------------ppat • Pixel Pattern old template---------------------------------*/
  233. /*
  234.     ppat_RezTemplateVersion:
  235.         0 - original 
  236.         1 - color plus simplified source format             <-- default
  237. */
  238. #ifndef ppat_RezTemplateVersion
  239.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  240.         #define ppat_RezTemplateVersion 0
  241.     #else
  242.         #define ppat_RezTemplateVersion 1
  243.     #endif
  244. #endif
  245.  
  246.  
  247. type 'ppat' {
  248.     #if ppat_RezTemplateVersion == 0 
  249.         /* PixPat record */
  250.         integer        oldPattern,                                    /* Pattern type            */
  251.                     newPattern,
  252.                     ditherPattern;
  253.     #else
  254.         integer = 1 /* newPattern */;                            /* Pattern type            */
  255.     #endif
  256.         unsigned longint = PixMap / 8;                            /* Offset to pixmap        */
  257.         unsigned longint = PixelData / 8;                        /* Offset to data        */
  258.         fill long;                                                /* Expanded pixel image    */
  259.         fill word;                                                /* Pattern valid flag    */
  260.         fill long;                                                /* expanded pattern        */
  261.         hex string [8];                                            /* old-style pattern    */
  262.  
  263.         /* PixMap record */
  264.     PixMap:
  265.         fill long;                                                /* Base address            */
  266.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  267.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  268.     #if ppat_RezTemplateVersion == 0 
  269.         unsigned bitstring[13];                                    /* Offset to next row    */
  270.         rect;                                                    /* Bitmap bounds        */
  271.         integer;                                                /* pixMap vers number    */
  272.         integer        unpacked;                                    /* Packing format        */
  273.         unsigned longint;                                        /* size of pixel data    */
  274.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  275.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  276.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  277.         integer;                                                /* # bits in pixel        */
  278.         integer;                                                /* # components in pixel*/
  279.         integer;                                                /* # bits per field        */
  280.         unsigned longint;                                        /* Offset to next plane    */
  281.         unsigned longint = ColorTable / 8;                        /* Offset to color table*/
  282.         fill long;                                                /* Reserved                */
  283.  
  284.     PixelData:
  285.         hex string [(ColorTable - PixelData) / 8];
  286.     #else
  287.  
  288.  
  289.     pMapRowBytes:
  290.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  291.     Bounds:    rect;                                                    /* Bitmap bounds        */
  292.         integer = 0;                                            /* pixMap vers number    */
  293.         integer = 0;                                            /* Packing format        */
  294.         fill long;                                                /* Size of pixel data    */
  295.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  296.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  297.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  298.     PixelSize:
  299.         integer;                                                /* # bits in pixel        */
  300.         integer = 1;                                            /* # components in pixel*/
  301.         integer = $$Word(PixelSize);                            /* # bits per field        */
  302.         fill long;
  303.         unsigned longint = ColorTable / 8;
  304.         fill long;
  305.  
  306.     PixelData:
  307.         hex string [PixMapRowBytes * PixMapHeight];
  308.     #endif
  309.     
  310.     ColorTable:
  311.         unsigned hex longint;                                    /* ctSeed                */
  312.         integer;                                                /* ctFlags                */
  313.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  314.         wide array ColorSpec {
  315.     #if ppat_RezTemplateVersion == 0
  316.                 integer;                                        /* value                */
  317.     #else
  318.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  319.     #endif
  320.                 unsigned integer;                                /* RGB:    red                */
  321.                 unsigned integer;                                /*        green            */
  322.                 unsigned integer;                                /*        blue            */
  323.         };
  324. };
  325.  
  326.  
  327. /*----------------------------ppt# • list of pixpats;--------------------------------------*/
  328. type 'ppt#' {
  329.                                             /* PixPat offsets (calculate them some day!?!) */
  330.     integer = $$CountOf(OffsetArray);
  331.     array OffsetArray {                         /* [$$CountOf(PixPatArray)] */ 
  332.         unsigned longint                     /* = PixPat[$$ArrayIndex(OffsetArray)] / 8 */;
  333.     };
  334.  
  335.     array PixPatArray {
  336.     PixPat:
  337.         /* PixPat record */
  338.         integer = 1 /* newPattern */;                            /* Pattern type            */
  339.         unsigned longint = PixMap[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to pixmap        */
  340.         unsigned longint = PixelData[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to data        */
  341.         fill long;                                                /* Expanded pixel image    */
  342.         fill word;                                                /* Pattern valid flag    */
  343.         fill long;                                                /* expanded pattern        */
  344.         hex string [8];                                            /* old-style pattern    */
  345.     
  346.         /* PixMap record */
  347.     PixMap:
  348.         fill long;                                                /* Base address            */
  349.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  350.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  351.     pMapRowBytesIndexed:
  352.         unsigned bitstring[13] = PixMapRowBytesIndexed;            /* Offset to next row    */
  353.     Bounds:        
  354.         rect;                                                    /* Bitmap bounds        */
  355.         integer = 0;                                            /* pixMap vers number    */
  356.         integer = 0;                                            /* Packing format        */
  357.         fill long;                                                /* Size of pixel data    */
  358.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  359.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  360.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  361.     PixelSize:
  362.         integer;                                                /* # bits in pixel        */
  363.         integer = 1;                                            /* # components in pixel*/
  364.         integer = $$Word(PixelSize[$$ArrayIndex(PixPatArray)]);    /* # bits per field        */
  365.         fill long;
  366.         unsigned longint = ColorTable[$$ArrayIndex(PixPatArray)] / 8;
  367.         fill long;
  368.     
  369.     PixelData:
  370.         hex string [PixMapRowBytesIndexed * PixMapHeightIndexed];
  371.  
  372.     
  373.     ColorTable:
  374.         unsigned hex longint = 0;                                /* ctSeed                */
  375.         integer = 0;                                            /* ctFlags                */
  376.         integer = $$Countof(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;    /* ctSize                */
  377.         wide array ColorSpec {
  378.                 integer = $$ArrayIndex(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;/* value                */
  379.                 unsigned integer;                                /* RGB:    red                */
  380.                 unsigned integer;                                /*        green            */
  381.                 unsigned integer;                                /*        blue            */
  382.         };
  383.     };
  384. };
  385.  
  386.  
  387. /*----------------------------mitq • Default queue sizes for MakeITable--------------------------------------*/
  388. type 'mitq' {                /* default MakeITable queue sizes */
  389.     wide array [3] {
  390.         unsigned longint;    /* queue size for 3, 4, and 5 bit inverse tables */
  391.     };
  392. };
  393.  
  394.  
  395. #endif /* __QUICKDRAW_R__ */
  396.  
  397.